package com.ruoyi.net.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.net.mapper.ElementDhcpMapper;
import com.ruoyi.net.domain.ElementDhcp;
import com.ruoyi.net.service.IElementDhcpService;

/**
 * 网元-DHCP配置Service业务层处理
 * 
 * @author net
 * @date 2024-11-17
 */
@Service
public class ElementDhcpServiceImpl implements IElementDhcpService 
{
    @Autowired
    private ElementDhcpMapper elementDhcpMapper;

    /**
     * 查询网元-DHCP配置
     * 
     * @param id 网元-DHCP配置主键
     * @return 网元-DHCP配置
     */
    @Override
    public ElementDhcp selectElementDhcpById(String id)
    {
        return elementDhcpMapper.selectElementDhcpById(id);
    }

    /**
     * 查询网元-DHCP配置列表
     * 
     * @param elementDhcp 网元-DHCP配置
     * @return 网元-DHCP配置
     */
    @Override
    public List<ElementDhcp> selectElementDhcpList(ElementDhcp elementDhcp)
    {
        return elementDhcpMapper.selectElementDhcpList(elementDhcp);
    }

    /**
     * 新增网元-DHCP配置
     * 
     * @param elementDhcp 网元-DHCP配置
     * @return 结果
     */
    @Override
    public int insertElementDhcp(ElementDhcp elementDhcp)
    {
        String uuid = IdUtils.simpleUUID();
        if (StringUtils.isEmpty(elementDhcp.getId())) {
            elementDhcp.setId(uuid);
        }
        elementDhcp.setCreateBy(SecurityUtils.getUsername());
        elementDhcp.setCreateTime(DateUtils.getNowDate());
        elementDhcp.setUpdateBy(SecurityUtils.getUsername());
        elementDhcp.setUpdateTime(DateUtils.getNowDate());
        return elementDhcpMapper.insertElementDhcp(elementDhcp);
    }

    /**
     * 修改网元-DHCP配置
     * 
     * @param elementDhcp 网元-DHCP配置
     * @return 结果
     */
    @Override
    public int updateElementDhcp(ElementDhcp elementDhcp)
    {
        elementDhcp.setUpdateBy(SecurityUtils.getUsername());
        elementDhcp.setUpdateTime(DateUtils.getNowDate());
        return elementDhcpMapper.updateElementDhcp(elementDhcp);
    }

    /**
     * 批量删除网元-DHCP配置
     * 
     * @param ids 需要删除的网元-DHCP配置主键
     * @return 结果
     */
    @Override
    public int deleteElementDhcpByIds(String[] ids)
    {
        return elementDhcpMapper.deleteElementDhcpByIds(ids);
    }

    /**
     * 删除网元-DHCP配置信息
     * 
     * @param id 网元-DHCP配置主键
     * @return 结果
     */
    @Override
    public int deleteElementDhcpById(String id)
    {
        return elementDhcpMapper.deleteElementDhcpById(id);
    }
}
